#include <vector>
#include <iostream>

using namespace std;

class Solution 
{
public:
    vector<int> searchRange(int A[], int n, int target)
	{
        // Start typing your C/C++ solution below
        // DO NOT write int main() function
		vector<int> range(2,-1);
		if(n<=0)
		{
			return range;
		}
		
        int left = 0, right = n-1, mid;
		while(left<=right)
		{
			mid = (left+right)/2;
			if(A[mid]>target)
				right = mid-1;
			else if(A[mid]==target)
			{
				if(mid==0 || A[mid-1]<target)
				{
					range[0] = mid;
					break;
				}
				else
				{
					right = mid-1;
				}
			}
			else
			{
				if(mid<(n-1))
				{
					if(A[mid+1] > target)
						return range;
					else if(A[mid+1] == target)
					{
						range[0] = mid+1;
						break;
					}
					else
						left = mid+1;
				}
				else
					return range;
			}
		}

		left = 0, right = n-1;
		while(left<=right)
		{
			mid = (left+right)/2;
			if(A[mid]<target)
			{
				left = mid+1;
			}
			else if(A[mid] == target)
			{
				if(mid==(n-1) || A[mid+1]>target)
				{
					range[1] = mid;
					return range;
				}
				else
					left = mid + 1;
			}
			else
			{
				if(mid>0)
				{
					if(A[mid-1] == target)
					{
						range[1] = mid-1;
						return range;
					}
					else if(A[mid-1]<target)
					{
						range[0] = -1;
						return range;
					}
					else
					{
						right = mid-1;
					}
				}
				else
				{
					range[0] = -1;
					return range;
				}
			}
		}

		range[0] = range[1] = -1;
		return range;

    }
};

int main()
{
	int n,k;
	Solution s;
	while(cin>>n)
	{
		if(n<=0)
			break;
		cin>>k;
		int* A = new int[n];
		for(int i=0;i<n;i++)
			cin>>A[i];

		vector<int> range = s.searchRange(A,n,k);
		cout<<range[0]<<" "<<range[1]<<endl;		
	}
}